package cn.hdu.liang.ch4;


import java.util.Timer;
import java.util.TimerTask;

public class TimerDemo1 {
    public static void main(String[] args) {
        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                System.out.println("闹铃响了");
                System.exit(0);
            }
        };

        Timer timer = new Timer();
        timer.schedule(task, 2000);
    }
}
